import Vue from 'vue'
import Vuex from 'vuex'

import mutations from './mutations'
import actions from './actions'
import getters from './getters'
import { getItem } from '../utils/storng.js'

Vue.use(Vuex);

let images = []
uni.getStorage({
	key: 'image',
	success: res => {
		if(res.data[0]!=''){
			images = res.data
		}
	}
})
let imageList = uni.getStorageSync('ImageList')
const state = {
	ystoKen:getItem("YSToken"),
	imageMom:imageList || [],
	subCabinetId: [], //副柜id
	token: null, 
	monitoringImage:images,
	ModbusId:0,
	hours: '0',
	minute: '00',
	second: '00',
	runTime: 0,
	id:null, //记录运行时长的id
	nowTimeId:null,
	nowTimeIdLogin:null,
	nowDate:'',
	nowTime:'',
	nowWeek:'',
	card_data:{},
	scan_data:{},
	inventory_transaction_num:0,//rfid事务回调标记
	//主柜
	mainCabinet:{
		terminalId:null,//机柜ID
		minorList:[],//副柜列表
		mainName:'',//编辑时暂存的柜子类型
		mainType:'',//编辑时暂存的柜子名称
		type:'',
		type:1,//类型 1-综合柜 2-层架柜 3-挂架柜
		card_id:0,
		scan_id:0,
		rfid_id:0,
		door_id:0,
		door_status:false,//门状态
		door_pull:false,//拉出
		inventory_status:false,//盘点状态
		ismian:true,
		authorizationList:[]//主柜授权人员列表
	},
	
}

const store = new Vuex.Store({
  state,
  getters,
  mutations,
  actions,

});


export default store